# -*- coding:utf-8 *-
# 项目       :    易聊测试 
# 文件       :    multi_window_launch.py
# 作者       :    zc 
# 时间       :    2021/9/18  8:50 上午 
# IDE       :    PyCharm
from selenium import webdriver
from selenium.webdriver.support.ui import WebDriverWait
import time
import os

def openURL():
    global d
    d = webdriver.Chrome()

    d.wait = WebDriverWait(d,10)
    d.set_window_size(1620, 960)
    data=0
    while data<12:
        d.get("file://Users/a1234/Downloads/%E6%9D%83%E9%87%8D%E8%AE%BF%E9%97%AE%E9%A1%B5.html")
        time.sleep(6)
        d.find_element_by_id('jesong_message').send_keys('我的第 %s 个用户'%data)
        d.find_element_by_xpath('//*[@id="jesong_chat_send_btn"]').click()
        time.sleep(2)
        data +=1
        print(data)


if __name__ == '__main__':
    openURL()